import { defineStore } from 'pinia'
import { getItem, setItem } from '@/utils/localStorage'
const key='counter'

export const useCounterStore = defineStore(key, {
  state: () => {
    return {
      value :  getItem(key) || 0
    }
  },
  actions: {
    increment() {
      this.value=this.value+1;
      setItem(key, this.value)
    },
  }
})
